<template>
  <div id="pdf">
    <pdf v-if="url && fileName" ref="pdf" :fileName="fileName" :url="url" :type="'canvas'" :pdfjsDistPath="'/public'"
         @onPdfClose="onPdfClose"></pdf>
  </div>
</template>

<script>
import pdf from "./pdf/pdf.vue";

export default {
  name: "pdf-viewer", //pdf预览工具
  components: {
    pdf
  },
  props: {
    url: String,
    fileName: String
  },
  setup(props, {emit}) {
    const onPdfClose = (e) => {
      emit('onPdfClose', e);
    }
    return {
      onPdfClose
    }
  }
}
</script>

<style scoped>
#pdf {
  position: fixed;
  top: 40px;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  z-index: 999;
  background: var(--color-bg-5);
}
</style>
